# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=lbmap
pkgver=147.2d15ace
pkgrel=5
groups=('blackarch' 'blackarch-fingerprint' 'blackarch-webapp')
pkgdesc='Proof of concept scripts for advanced web application fingerprinting, presented at OWASP AppSecAsia 2012.'
arch=('any')
url='https://github.com/wireghoul/lbmap'
license=('GPL3')
depends=('perl' 'perl-data-dump' 'perl-io-socket-ssl' 'perl-getopt-long')
makedepends=('git')
source=("git+https://github.com/wireghoul/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README Changelog
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README Changelog

  cp -a lib lbmap aprof "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"

  cat > "$pkgdir/usr/bin/aprof" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl aprof "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/aprof"
}

